import java.util.*;
public class Coord implements Cloneable {
    // Initializes a Move.
    public Coord(double x, double y) {
	this.x = x;
	this.y = y;
    }

    // Accessors and simple modification functions. These should be mostly
    // self-explanatory.
    public double X() {
	return x;
    }

    public double Y() {
	return y;
    }

    // Returns the distance between two planets, rounded up to the next highest
    // integer. This is the number of discrete time steps it takes to get
    // between the two planets.
    public int Distance(int destPlanet, List<Planet> planets) {
        Planet dest = planets.get(destPlanet);
        return Distance(dest);
    }

    public int Distance(Planet dest) {
        double dx = X() - dest.X();
        double dy = Y() - dest.Y();
        return (int) Math.ceil(Math.sqrt(dx * dx + dy * dy));
    }

    public int Distance(Coord point) {
        double dx = X() - point.X();
        double dy = Y() - point.Y();
        return (int) Math.ceil(Math.sqrt(dx * dx + dy * dy));
    }


    private double x;
    private double y;

    private Coord (Coord _m) {
	x = _m.x;
	y = _m.y;
    }

    @Override
    public Object clone() {
	return new Coord(this);
    }
}
